package com.zzyl.service.impl;

import com.zzyl.entity.Bed;
import com.zzyl.mapper.BedMapper;
import com.zzyl.service.BedService;
import com.zzyl.vo.BedVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BedServiceImpl implements BedService {

    @Autowired
    private BedMapper bedMapper;

    @Override
    public List<BedVo> getBedsByRoomId(Long roomId) {
        return bedMapper.getBedsByRoomId(roomId);
    }

    @Override
    public void createBed(Bed bed) {
        //设置床位的初始状态
        bed.setBedStatus(0);
        bedMapper.createBed(bed);
    }

    @Override
    public BedVo readById(Long id) {
        return bedMapper.selectById(id);
    }

    @Override
    public void updateBed(Bed bed) {
        bedMapper.update(bed);
    }

    @Override
    public void deleteById(Long id) {
        bedMapper.delete(id);
    }

}

